<?php
/**
 * House table class
 * 
 * @package    Joomla.Tutorials
 * @subpackage Components
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4
 * @license		GNU/GPL
 */

// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

/**
 * House Table class
 *
 * @package    Congregation
 * @subpackage Components
 */
class TableHouse extends JTable
{
	/**
	 * Primary Key
	 *
	 * @var int
	 */
	var $c_id = null;
	
	var $p_id   = null;
	var $c_name  = null;
	var $c_address  = null;
	var $c_country  = null;
	var $c_tel  = null;
	var $c_fax  = null;
	var $c_email  = null;
	var $c_web  = null;
	var $c_found  = null;
	var $c_diocese  = null;
	var $c_picfile  = null;
	var $c_info = null;
	var $lastupdate  = null;
	var $submitter  = null;
	var $hit  = null;
	var $ordering = null;
	
/**
	 * Constructor
	 *
	 * @param object Database connector object
	 */
	function TableHouse(& $db) {
		parent::__construct('#__congregation_casa', 'c_id', $db);
	}
	
	function check() {
		if (trim($this->c_name) == '') {
	      $this->_db->setError(JText::_('Please enter the House name'));
	      return false;
	    }
		
		if (!isset($this->p_id))
		{
	      $this->_db->setError(JText::_('Please select a Province'));
	      return false;
		}
		
		return true;
	}	
}